import sun.font.FontRunIterator;

import java.util.Comparator;
import java.util.Objects;

public class Test {
    public static void main(String[] args) {

        person p=new person("张三",20);
    }
}
class person implements Cloneable,Comparable, Comparator<person>
{
    String name;
    int age;

    public person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public int compare(person person, person t1) {
        return person.name.compareTo(t1.name);
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof person)) return false;
        person person = (person) o;
        return age == person.age && name.equals(person.name);
    }

    @Override
    public Comparator<person> reversed() {
        return Comparator.super.reversed();
    }

    @Override
    public String toString() {
        return "person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, age);
    }

    public int compareTo(Object o) {
        person tmp=(person) o;
        return this.age-tmp.age;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return null;
    }

}
class mysort{
    public void sort(person[] arr){
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j <arr.length-1-i ; j++) {
                if(arr[i].compareTo(arr[i+1])>0){

                }
            }
        }
    }
}